Testing IPython
# %load_ext asmarkdown
%%asmarkdown
print '''
* what does this do?
* what does that do?
'''
- what does this do?
- what does that do?
nwalks = 5000
nsteps = 1000
draws = np.random.randint(0, 2, size=(nwalks, nsteps)) * 2 - 1
draws
array([[-1, 1, 1, ..., 1, -1, 1], [ 1, -1, -1, ..., 1, 1, 1], [ 1, 1, -1, ..., -1, -1, -1], ..., [ 1, 1, 1, ..., -1, 1, 1], [ 1, -1, -1, ..., 1, 1, 1], [ 1, 1, -1, ..., 1, 1, 1]])
walk = np.cumsum(draws, 1)
walk
array([[ -1, 0, 1, ..., 34, 33, 34], [ 1, 0, -1, ..., -46, -45, -44], [ 1, 2, 1, ..., -14, -15, -16], ..., [ 1, 2, 3, ..., 2, 3, 4], [ 1, 0, -1, ..., -16, -15, -14], [ 1, 2, 1, ..., 4, 5, 6]])
x = np.arange(0, nsteps)
for i in range(0,10):
plt.plot(x, walk[i])
import matplotlib.image as mpimg
img=mpimg.imread('stinkbug.png')
imgplot = plt.imshow(img)
lum_img = img[:,:,0]
imgplot = plt.imshow(lum_img)
plt.imshow(lum_img, cmap="hot")
plt.colorbar()
<matplotlib.colorbar.Colorbar at 0x1140b1250>
data = plt.hist(lum_img.ravel(), bins=256, range=(0.0, 1.0), fc='k', ec='k')
imgplot = plt.imshow(lum_img, clim=(0.0, 0.7))